#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
void swap(int* a, int* b) {
	int tmp = *b;
	*b = *a;
	*a = tmp;
}
void bubble_sort(int*a,int n) {
	for (int i = 0; i < n; i++) {
		int flag = 0;
		for (int j = 0; j < n - i - 1; j++) {
			if (a[j] > a[j+ 1]) {
				swap(&a[j], &a[j + 1]);
				flag = 1;
			}
			
		}
		if (flag == 0) {
			break;
		}
	}
}
int main() {
	int arr[12] = { 1313,13,46,646,24,63,46,777,22,1331,4164,4 };
	int size = sizeof(arr) / sizeof(int);
	bubble_sort(arr, size);
	for (int i = 0; i < size; i++) {
		printf("%d ", arr[i]);
	}
	return 0;
}